# person_list = []
#
# for i in range(10):
#     # 声明字典
#     person_dict = {"name": "fly" + str(i), "age": "1" + str(i)}
#     # 把字典添加到列表集合中去
#     person_list.append(person_dict)
#
# print(type(person_list))
# print(person_list)
#
# import json
#
# """
# list转换成json
# """
#
#
# def list_tran_json(list):
#     str_json = json.dumps(list, ensure_ascii=False, indent=2)
#     return str_json
#
#
# """
# json转换成list
# """
#
#
# def json_tran_list(str_json):
#     list = json.loads(str_json)
#     return list
#
#
# # 声明一个空的列表
# person_list = []
#
# program_list = ["Python", "Java", "C", "数据结构"]
#
# for i in range(6):
#     # 声明字典 增加列表属性
#     person_dict = {"name": "fly" + str(i), "age": "1" + str(i), "program_list": program_list}
#     # 把字典添加到列表集合中去
#     person_list.append(person_dict)
#
# print(type(person_list))
# print(person_list)
# print("*" * 100)
#
# str_json = list_tran_json(person_list)
# print(type(str_json))
# print(str_json)

# class MyObject:
#     def __init__(self, value):
#         self.value = value
#
#     def __hash__(self):
#         return 42  # 所有对象的哈希值都相同，强制哈希冲突
#
#     def __eq__(self, other):
#         return self.value == other.value  # 判断值是否相等
#
# # 创建两个不同的对象，但哈希值相同
# obj1 = MyObject(1)
# obj2 = MyObject(2)
#
# s = {obj1}
# s.add(obj2)
# print(len(s))  # 2，obj1 和 obj2 不相等（通过 __eq__ 判断），因此都被加入集合

# my_set = {'apple', 'banana', 'cherry'}
# string_from_set = ', '.join(my_set)
# print(string_from_set)
#
# my_set = {1, 2, 3}
# list_from_set = list(my_set)
# string_list = [str(i) for i in list_from_set]
# string_from_set = "".join(string_list)
# print(string_from_set)
#
#
# my_string = "apple"
# set_from_string = set(my_string)
# print(set_from_string)


# from elasticsearch import Elasticsearch
#
# es = Elasticsearch("http://118.178.236.180:9200")
# es.index(index='doctor', body={
#                 'id': 1,
#                 'table_name': 'doctor',
#                 'name': "小明",
#                 'type':'doctors'
#             })
#
# dsl = {
#     "query": {
#         "match_all": {}
#     }
# }
# res = es.search(index="doctor", body=dsl)
# print(res)
# for hit in res['hits']['hits']:
#     print("%(id)s %(name)s" % hit["_source"])


# my_set = { "apple", "banana", "cherry"}
# string_from_set = "0".join(my_set)
# print(string_from_set)


my_set = {'1', '2', '3'}
list_from_set = list(my_set)
print(list_from_set)
# string_list = [str(i) for i in list_from_set]
# 生成器
string_from_set = "".join(str(i) for i in my_set)
print(string_from_set)